<?php

declare (strict_types=1);
namespace App\Model;

/**
 * @property int $id
 * @property int $eid
 * @property string $result
 * @property string $score
 * @property string $recommend
 */
class EvaluationLog extends Model
{
    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'evaluation_log';
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = ['id', 'eid', 'result', 'score', 'recommend'];
    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = ['id' => 'integer', 'eid' => 'integer'];

    public static function getMyEvaluationList($uid)
    {

        $model = self::from('evaluation_log as a')
            ->leftJoin('psychological_assessment as b','a.eid','=','b.id')
            ->where(['a.uid'=>$uid,'b.status'=>1])
            ->select(['a.create_time','a.id','a.eid','b.name','b.cover','b.charge'])
            ->orderBy('a.create_time','desc');


        return page($model);



    }
}
